import { createRouter, createWebHashHistory } from "vue-router";
import type { RouteRecordRaw } from "vue-router";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    name: "home",
    component: () => import("../views/Library.vue"),
  },
  {
    path: "/reader/:bookId",
    name: "reader",
    component: () => import("../views/Reader.vue"),
    props: true,
  },
  {
    path: "/marks",
    name: "marks",
    component: () => import("../views/Marks.vue"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior() {
    return { top: 0 };
  },
});

export default router;
